<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Tom的博客">
    <meta name="keyword"  content="">
    <link rel="shortcut icon" href="/img/favicon.ico">

    <title>
        
        使用micropython开发esp8266.md - Tom的博客
        
    </title>

    <!-- Custom CSS -->
    
<link rel="stylesheet" href="/css/aircloud.css">

    
<link rel="stylesheet" href="/css/gitment.css">

    <!--<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">-->
    <link href="//at.alicdn.com/t/font_620856_pl6z7sid89qkt9.css" rel="stylesheet" type="text/css">
    <!-- ga & ba script hoook -->
    <script></script>
<meta name="generator" content="Hexo 5.4.0"></head>

<body>

<div class="site-nav-toggle" id="site-nav-toggle">
    <button>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
    </button>
</div>

<div class="index-about">
    <i> 间歇性壮志凌云, 持续性混吃等死 </i>
</div>

<div class="index-container">
    
    <div class="index-left">
        
<div class="nav" id="nav">
    <div class="avatar-name">
        <div class="avatar ">
            <img src="/img/avatar.jpg" />
        </div>
        <div class="name">
            <i>Tom</i>
        </div>
    </div>
    <div class="contents" id="nav-content">
        <ul>
            <li >
                <a href="/">
                    <i class="iconfont icon-shouye1"></i>
                    <span>主页</span>
                </a>
            </li>
            <li >
                <a href="/tags">
                    <i class="iconfont icon-biaoqian1"></i>
                    <span>标签</span>
                </a>
            </li>
            <li >
                <a href="/archives">
                    <i class="iconfont icon-guidang2"></i>
                    <span>存档</span>
                </a>
            </li>
            <li >
                <a href="/about/">
                    <i class="iconfont icon-guanyu2"></i>
                    <span>关于</span>
                </a>
            </li>
            
            <li>
                <a id="search">
                    <i class="iconfont icon-sousuo1"></i>
                    <span>搜索</span>
                </a>
            </li>
            
        </ul>
    </div>
    
        <div id="toc" class="toc-article">
    <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8micropython%E5%BC%80%E5%8F%91esp8266"><span class="toc-text">使用micropython开发esp8266</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9C%A8esp8266%E4%B8%8A%E4%B8%8B%E8%BD%BDmicropython%E5%9B%BA%E4%BB%B6"><span class="toc-text">在esp8266上下载micropython固件</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8%E4%B8%B2%E5%8F%A3%E8%BF%9E%E6%8E%A5%E5%88%B0esp8266"><span class="toc-text">使用串口连接到esp8266</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8ampy%E5%B7%A5%E5%85%B7%E5%B0%86%E5%86%99%E5%A5%BD%E7%9A%84%E7%A8%8B%E5%BA%8F%E5%8F%91%E9%80%81%E5%88%B0%E6%9D%BF%E5%AD%90%E7%9A%84flash"><span class="toc-text">使用ampy工具将写好的程序发送到板子的flash</span></a></li></ol></li></ol>
</div>
    
</div>


<div class="search-field" id="search-field">
    <div class="search-container">
        <div class="search-input">
            <span id="esc-search"> <i class="icon-fanhui iconfont"></i></span>
            <input id="search-input"/>
            <span id="begin-search">搜索</span>
        </div>
        <div class="search-result-container" id="search-result-container">

        </div>
    </div>
</div>

        <div class="index-about-mobile">
            <i> 间歇性壮志凌云, 持续性混吃等死 </i>
        </div>
    </div>
    
    <div class="index-middle">
        <!-- Main Content -->
        


<div class="post-container">
    <div class="post-title">
        使用micropython开发esp8266.md
    </div>

    <div class="post-meta">
        <span class="attr">发布于：<span>2019-11-30 17:14:44</span></span>
        
        <span class="attr">标签：/
        
        <a class="tag" href="/tags/#esp8266" title="esp8266">esp8266</a>
        <span>/</span>
        
        
        </span>
        <span class="attr">访问：<span id="busuanzi_value_page_pv"></span>
</span>
</span>
    </div>
    <div class="post-content no-indent">
        <h1 id="使用micropython开发esp8266"><a href="#使用micropython开发esp8266" class="headerlink" title="使用micropython开发esp8266"></a>使用micropython开发esp8266</h1><h2 id="在esp8266上下载micropython固件"><a href="#在esp8266上下载micropython固件" class="headerlink" title="在esp8266上下载micropython固件"></a>在esp8266上下载micropython固件</h2><p>micropython固件<a target="_blank" rel="noopener" href="http://www.micropython.org/download">下载地址</a></p>
<p>首先需要在电脑上安装好python3，在安装过程中需要选择为所有人安装，安装完成后需要授予用户安装目录的完全控制权限，然后将板子连接到电脑，到设备管理器找到对应的com口记住。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 安装下载工具</span></span><br><span class="line">pip install esptool</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 清空flash</span></span><br><span class="line">esptool.py --port /dev/ttyUSB0 erase_flash</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 下载固件</span></span><br><span class="line">esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect -fm dio 0 esp8266-20170108-v1.8.7.bin</span><br></pre></td></tr></table></figure>
<h2 id="使用串口连接到esp8266"><a href="#使用串口连接到esp8266" class="headerlink" title="使用串口连接到esp8266"></a>使用串口连接到esp8266</h2><p>可以使用putty，teraterm，mobaxterm，注意在使用mobaxterm的时候需要将<em>Flow control</em>设置为none，否则会无法输入。</p>
<h2 id="使用ampy工具将写好的程序发送到板子的flash"><a href="#使用ampy工具将写好的程序发送到板子的flash" class="headerlink" title="使用ampy工具将写好的程序发送到板子的flash"></a>使用ampy工具将写好的程序发送到板子的flash</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> install ampy</span></span><br><span class="line">pip install adafruit-ampy</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> use ampy</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> PS C:\Users\tom\Documents\blog&gt; ampy --<span class="built_in">help</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> Usage: ampy [OPTIONS] COMMAND [ARGS]...</span></span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">   ampy - Adafruit MicroPython Tool</span></span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">   Ampy is a tool to control MicroPython boards over a serial connection.</span></span><br><span class="line"><span class="meta">#</span><span class="bash">   Using ampy you can manipulate files on the board<span class="string">&#x27;s internal filesystem and</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   even run scripts.</span></span></span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string"> Options:</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   -p, --port PORT    Name of serial port for connected board.  Can optionally</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">                      specify with AMPY_PORT environment variable.  [required]</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   -b, --baud BAUD    Baud rate for the serial connection (default 115200).</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">                      Can optionally specify with AMPY_BAUD environment</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">                      variable.</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   -d, --delay DELAY  Delay in seconds before entering RAW MODE (default 0).</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">                      Can optionally specify with AMPY_DELAY environment</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">                      variable.</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   --version          Show the version and exit.</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   --help             Show this message and exit.</span></span></span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string"> Commands:</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   get    Retrieve a file from the board.</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   ls     List contents of a directory on the board.</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   mkdir  Create a directory on the board.</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   put    Put a file or folder and its contents on the board.</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   reset  Perform soft reset/reboot of the board.</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   rm     Remove a file from the board.</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   rmdir  Forcefully remove a folder and all its children from the board.</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="string">   run    Run a script and print its output.</span></span></span><br><span class="line">ampy -p com* ls</span><br></pre></td></tr></table></figure>

        
            <div class="donate-container">
    <div class="donate-button">
        <button id="donate-button">赞赏</button>
    </div>
    <div class="donate-img-container hide" id="donate-img-container">
        <img id="donate-img" src="" data-src="/img/donate.jpg">
        <p> 感谢鼓励 </p>
    </div>
</div>
        
        <br />
        <div id="comment-container">
        </div>
        <div id="disqus_thread"></div>

        <div id="lv-container">
        </div>

    </div>
</div>

    </div>
</div>


<footer class="footer">
    <ul class="list-inline text-center">
        
        

        

        

        

        

    </ul>
    
    <p>
        <span id="busuanzi_container_site_pv">
            <span id="busuanzi_value_site_pv"></span>PV
        </span>
        <span id="busuanzi_container_site_uv">
            <span id="busuanzi_value_site_uv"></span>UV
        </span>
        Created By <a target="_blank" rel="noopener" href="https://hexo.io/">Hexo</a>  Theme <a target="_blank" rel="noopener" href="https://github.com/aircloud/hexo-theme-aircloud">AirCloud</a></p>
</footer>




<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
        tex2jax: {
            inlineMath: [ ["$","$"], ["\\(","\\)"] ],
            skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'],
            processEscapes: true
        }
    });
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax();
        for (var i = 0; i < all.length; ++i)
            all[i].SourceElement().parentNode.className += ' has-jax';
    });
</script>
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</body>

<script>
    // We expose some of the variables needed by the front end
    window.hexo_search_path = "search.json"
    window.hexo_root = "/"
    window.isPost = true
</script>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

<script src="/js/index.js"></script>

<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>




</html>
